/** Class Name: OORTelesalesLeadInteractionLogTest
 * Author: Accenture
 * Date: 3-March-2012
 * Requirement/Project Name: OOR Telesales
 * Requirement Description:  Test class for OORTelesalesLeadInteractionLog
 **/
 
@istest(seealldata=true)
private class OORTelesalesLeadInteractionLogTest
{   
        
    /**
     *  Test method 
     */  
    static testMethod void testGetFirstLead() 
    {
      ID localAdvertiserRecordTypeID = RecordTypeHelper.GetRecordTypeIdByDevName('Lead', OORTelesalesTextConstant.LOCAL_ADVERTISER_LEAD_REC_TYPE);   
      List<Sobject> campList  = new List<Sobject>();
      Lead  le  = new Lead(FirstName='testFirstName',LastName = 'ash', company='ABc',Lead_Status_ReadOnly__c = 'New' ,Status='New',RecordTypeId= localAdvertiserRecordTypeID );
      insert le;
      
     
      ApexPages.StandardController StdCtrl = new ApexPages.StandardController(le);
      OORTelesalesLeadInteractionLogCtrl    inLog= new OORTelesalesLeadInteractionLogCtrl  (StdCtrl);
      inLog.setCallAttachedData();
       inLog.setCallBeginData();
       inLog.setCallEndData();
       inLog.saveAndNew();
       inLog.nextLead();
       inLog.acceptLead();
       inLog.initDispReason();
      
    }
    static testMethod void testUpdateonHoldTimeonLead() 
    {
    ID localAdvertiserRecordTypeID = RecordTypeHelper.GetRecordTypeIdByDevName('Lead', OORTelesalesTextConstant.LOCAL_ADVERTISER_LEAD_REC_TYPE);   
            
      Campaign camp = new Campaign(Name='abx',of_Hours_on_hold__c=4,IsActive=True,StartDate=Date.Today());
      insert camp;
      
      Lead  le  = new Lead(FirstName='testFirstname',OORTelesalesCampaign__c=camp.Id,LastName = 'ash', company='ABc',Lead_Status_ReadOnly__c = 'New' ,Status='New',RecordTypeId=localAdvertiserRecordTypeID );
      insert le;

      /*
      CampaignMember  campMemb  = new CampaignMember();
      campMemb.CampaignId =camp.id;
      campMemb.LeadID =le.id;
      insert campMemb ;
      */
      
      Task newTesttask= New Task();
      newTesttask.WhoId=le.id;
      newTesttask.Disposition__c=OORTelesalesTextConstant.CALLED_LEFT_VM ; 
      Insert newTesttask;
      Integer hoursOnHold = Integer.valueOf(camp.of_Hours_on_hold__c);      
      le.CampaignTimer__c= System.now().addHours(hoursOnHold );
      Update le;
      
     }
}